﻿// JScript 文件
$(function() {
    $( "#dialog:ui-dialog" ).dialog( "destroy" );
    $(window.parent.document).find("#contentTitle").text("断站原因>审核");
    $("#Query_Reason").button();  
    $("#Approval").button();   
    $("#Overrule").button(); 
    $("#Excel").button();              
    $("body > div[role=dialog]").appendTo("form#form1");
});
function onclicksel() {   
   var chkobj = document.getElementById("BoxIdAll");
   if(chkobj.checked == true) {
      selAll();
   }
   else {
      removeAll();
   }
} 

function selAll() {
  var selobj = document.getElementsByName("BoxId");
  for(var i = 0; i < selobj.length; i++) {
    if (!selobj[i].disabled) {
      selobj[i].checked = true;
    }
  }
}
	
function removeAll() {
   var selobj = document.getElementsByName("BoxId");
   for(var i = 0; i < selobj.length; i++) {
      selobj[i].checked = false;
   }
} 

function batchAudit(id) {
   var AuditVal = "";
   var bid = document.getElementsByName("BoxId");
   for(var i = 0; i < bid.length; i++) {
       if(bid[i].checked == true){
          AuditVal = AuditVal + bid[i].value + ",";
       }
    }
    if(AuditVal.length <= 0) {
        alert("请先选择要审核的项");
        return false;
    }
    else {
        if(id == "Approval") {
          if(confirm("您确认要审核吗？")) {
             $("#HidRID").val(AuditVal);
             return true;
          }
          return false;
       }
      else if(id == "Overrule") {
          var reason=prompt("请输入驳回原因！","原因不符");
          if(reason!=null && reason != ""){
             $("#HidRID").val(AuditVal);
             $("#HidOverReason").val(reason);
             return true;
          }
          return false;
      }
    }
} 

